
define('simplifyJsonFilter', ['angular'], function (angular) {
    var module = angular.module('filters');
    module.filter('simplifyJsonFilter', [function() {
	    return function(object) {
	    	var tmp=object;
	    	deleteEmptyProperty(tmp);
	    	return tmp;
	    };
	    function deleteEmptyProperty(object){
		    for (var i in object) {
		        var value = object[i];
		        if (typeof value === 'object') {
		            if (Array.isArray(value)) {
		                if (value.length === 0) {
		                    delete object[i];
		                    continue;
		                }
		            }
		            deleteEmptyProperty(value);
		            if (isEmpty(value)) {
		                delete object[i];
		            }
		        } else {
		            if (value === '' || value === null || value === undefined) {
		                delete object[i];
		            } else {

		            }
		        }
		    }
		}
		function isEmpty(object) {
		    for (var name in object) {
		        return false;
		    }
		    return true;
		}
  	}]);
});
